<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>改变盒子大小</title>
		<style>
			#box{
				width: 50px;
				height: 50px;
				margin: 0 auto;
				background: yellowgreen;
			}
		</style>
	</head>
	<body>
		<div id="box"></div>
		<script>
			//根据用户的点击次数完成盒子大小的改变
			//单击的次数为奇数时，盒子变大，单击次数为偶数时，盒子变小(文字)
			var box=document.getElementById('box');
			var a=0;
			box.onclick=function(){
				a++;
				if (a%2==0) {
					box.innerHTML="小";
					box.style.width='50px';
					box.style.height='50px';
				} else{
					box.innerHTML="大";
					box.style.width='150px';
					box.style.height='150px';
				}
			};
		</script>
	</body>
</html>
